/**
 * First we will load all of this project's JavaScript dependencies which
 * include Vue and Vue Resource. This gives a great starting point for
 * building robust, powerful web applications using Vue and Laravel.
 */

require('./bootstrap');
// window.$ = window.jQuery = require('jquery');
//require('bootstrap-sass');

/**
 * Next, we will create a fresh Vue application instance and attach it to
 * the body of the page. From here, you may begin adding components to
 * the application, or feel free to tweak this setup for your needs.
 */

import Vue from 'vue'
//import App from './App.vue'
import VueRouter from 'vue-router'
import Example from './components/Example.vue'

import User from './components/User/User.vue'
import SpecialUser from './components/User/SpecialUser.vue'
//import UserList from './components/User/UserList.vue'

import Admin from './components/Admin/Admin.vue'
import AddAdmin from './components/Admin/AddAdmin.vue'
import AdminList from './components/Admin/AdminList.vue'

//Vue.component('example', require('./components/Example.vue'));
Vue.use(VueRouter);

Vue.component(
    'passport-clients',
    require('./components/passport/Clients.vue')
);

Vue.component(
    'passport-authorized-clients',
    require('./components/passport/AuthorizedClients.vue')
);

Vue.component(
    'passport-personal-access-tokens',
    require('./components/passport/PersonalAccessTokens.vue')
);

//Vue.config.devtools = true
const routes = [
    { path: '/home', component: Example },
    {
        path: '/user',
        component: User,
        children: [
            //{
            //    path: 'list',
            //    component: UserList
            //},
            {
                path: 'special',
                component: SpecialUser
            },
        ]
    },
    {
        path: '/admin',
        component: Admin,
        children: [
            {
                path: 'list',
                component: AdminList
            },
            {
                path: 'add',
                component: AddAdmin
            },
        ]
    },
    //{ path: '/user/special', component: SpecialUser }
];

Vue.http.interceptors.push((request, next) => {
    request.headers.set('X-CSRF-TOKEN', Laravel.csrfToken);
    next();
});

const router = new VueRouter({
    routes: routes
});

const app = new Vue({router}).$mount('#app');

